package xiaoGongJu;

import java.io.IOException;
import java.util.stream.Stream;

public class JinDuTiao {
    public static void main(String[] args) throws IOException {
        char incomplete = ' ';
        char complete = '=';
        int total = 100;
        StringBuilder builder = new StringBuilder();
        Stream.generate(() -> incomplete).limit(total).forEach(builder::append);
        for (int i = 0; i < total; i++) {
            builder.replace(i, i + 1, String.valueOf(complete));
            String progressBar = "\r" + builder;
            String percent = " " + (i + 1) + "%";
            System.out.print(progressBar + percent);
            try {
                Thread.sleep(i * 5L);
            } catch (InterruptedException ignored) {

            }
        }
    }
}